package abstractEntities;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.GenericGenerator;

import entities.Inventory;
import entities.Itens;

/**
 * AbstractItemrecord entity provides the base persistence definition of the
 * Itemrecord entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractItemrecord implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 4231779532321645682L;
	private Integer idRecord;
	private Itens itens;
	private Inventory inventory;
	private Integer ntimesLeft;
	private Date stockdate;
	private Date expirationDate;

	// Constructors

	/** default constructor */
	public AbstractItemrecord() {
	}

	/** minimal constructor */
	public AbstractItemrecord(Itens itens, Inventory inventory) {
		this.itens = itens;
		this.inventory = inventory;
	}

	/** full constructor */
	public AbstractItemrecord(Itens itens, Inventory inventory,
			Integer ntimesLeft, Date stockdate, Date expirationDate) {
		this.itens = itens;
		this.inventory = inventory;
		this.ntimesLeft = ntimesLeft;
		this.stockdate = stockdate;
		this.expirationDate = expirationDate;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "idRecord", unique = true, nullable = false)
	public Integer getIdRecord() {
		return this.idRecord;
	}

	public void setIdRecord(Integer idRecord) {
		this.idRecord = idRecord;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idItem", nullable = false)
	public Itens getItens() {
		return this.itens;
	}

	public void setItens(Itens itens) {
		this.itens = itens;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idInventory", nullable = false)
	public Inventory getInventory() {
		return this.inventory;
	}

	public void setInventory(Inventory inventory) {
		this.inventory = inventory;
	}

	@Column(name = "nTimesLeft")
	public Integer getNtimesLeft() {
		return this.ntimesLeft;
	}

	public void setNtimesLeft(Integer ntimesLeft) {
		this.ntimesLeft = ntimesLeft;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "stockdate", length = 10)
	public Date getStockdate() {
		return this.stockdate;
	}

	public void setStockdate(Date stockdate) {
		this.stockdate = stockdate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "expirationDate", length = 10)
	public Date getExpirationDate() {
		return this.expirationDate;
	}

	public void setExpirationDate(Date expirationDate) {
		this.expirationDate = expirationDate;
	}

}